package com.sharedlease.websocket;


import com.sharedlease.entity.Chat;
import com.sharedlease.entity.Message;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.SchedulerException;

import java.io.IOException;




public class SingleMessageJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext){
        try {
            UserWebsocketServer server = new UserWebsocketServer();
            Chat chat = (Chat) jobExecutionContext.getScheduler().getContext().get("message");
            server.sendMessage(chat.getDestId() + "", chat);

        } catch (IOException | SchedulerException e) {
            e.printStackTrace();
        }
    }
}
